package cc.lzmsh.controller;

import cc.lzmsh.annotation.SystemLog;
import cc.lzmsh.domain.dto.RegisterDTO;
import cc.lzmsh.domain.dto.UserInfoDTO;
import cc.lzmsh.domain.result.Result;
import cc.lzmsh.domain.vo.UserInfoVo;
import cc.lzmsh.service.CommentService;
import cc.lzmsh.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Author:   msh
 * Date:     2024/9/22 下午3:44
 * Description:
 */

@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    @GetMapping("/userInfo")
    public Result<UserInfoVo> userInfo() {
        return userService.userInfo();
    }

    @PutMapping("/userInfo")
    @SystemLog(businessName = "更新用户信息")
    public Result updateUserInfo(@RequestBody UserInfoDTO userInfoDTO) {
        return userService.updateUserInfo(userInfoDTO);
    }

    @PostMapping("/register")
    public Result register(@RequestBody RegisterDTO registerDTO) {
        return userService.register(registerDTO);
    }
}
